package com.keba.lamp.ai.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.keba.basic.utils.ArgumentAssert;
import com.keba.lamp.ai.entity.AiEndPoint;
import com.keba.lamp.ai.service.AiEndPointService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.keba.lamp.ai.service.AiModelVersionService;
import com.keba.basic.base.service.impl.SuperServiceImpl;
import com.keba.lamp.ai.manager.AiModelVersionManager;
import com.keba.lamp.ai.entity.AiModelVersion;
import com.keba.lamp.ai.vo.save.AiModelVersionSaveVO;
import com.keba.lamp.ai.vo.update.AiModelVersionUpdateVO;
import com.keba.lamp.ai.vo.result.AiModelVersionResultVO;
import com.keba.lamp.ai.vo.query.AiModelVersionPageQuery;

import java.util.Collection;

/**
 * <p>
 * 业务实现类
 * 模型版本
 * </p>
 *
 * @author twg
 * @date 2025-03-22 13:59:56
 * @create [2025-03-22 13:59:56] [twg] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Service
public class AiModelVersionServiceImpl extends SuperServiceImpl<AiModelVersionManager, Long, AiModelVersion> implements AiModelVersionService {

    private final AiEndPointService aiEndPointService;

    @Override
    public boolean removeByIds(Collection<Long> idList) {
        boolean isExist = aiEndPointService.getSuperManager().exists(Wrappers.<AiEndPoint>lambdaQuery().in(AiEndPoint::getModelVersionId, idList));
        ArgumentAssert.isFalse(isExist, "存在模型版本正在被使用，无法删除");
        return super.removeByIds(idList);
    }
}


